const log = console.log

const utils = {
  /* 加载图片 */
  imageFromPath(path) {
    let img = new Image()
    img.src = path
    return img
  },
  /* 判断两个矩形相交 */
  intersect(rectA, rectB) {
    return !(
      rectA.x + rectA.w < rectB.x ||
      rectA.x > rectB.x + rectB.w ||
      rectA.y + rectA.h < rectB.y ||
      rectA.y > rectB.y + rectB.h
    )
  }
}
